<?php

// +----------------------------------------------------------------------
// | 简易CMS
// +----------------------------------------------------------------------
// | Copyright (C) 2010 Hoping Software Studio.
// +----------------------------------------------------------------------
// | Version $Id$ <code-tech.diandian.com>
// +----------------------------------------------------------------------
namespace Addons\SiteStat;

use Addons\Addon; ;

/**
 * 系统环境信息插件
 * @author thinkphp
 */
class SiteStatAddon extends Addon {
    public $info = array(
        'name'        => 'SiteStat',
        'title'       => '站点统计信息',
        'description' => '统计站点的基础信息',
        'status'      => 1,
        'author'      => 'thinkphp',
        'version'     => '0.1'
    );

    public function install() {
        return true;
    }

    public function uninstall() {
        return true;
    }

    //实现的AdminIndex钩子方法
    public function AdminIndex($param) {
        $config = $this->getConfig();
        $this->assign('addons_config', $config);
        if ($config['display']) {
            $info['user'] = M('Member')->count();
            $info['action'] = M('ActionLog')->count();
            $info['document'] = M('ArticleTitle')->count();
            $info['category'] = M('Category')->count();
            $info['model'] = M('Tags')->count();
            $this->assign('info', $info);
            $this->display('info');
        }
    }

}
